package com.bluesimon.wbf.usercenter.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.ume.school.modules.utils.TimeUtils;

import com.bluesimon.wbf.IUser;
import com.bluesimon.wbf.usercenter.enums.UserCheckStatusEnum;

/**
 * 用户
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "uc_user_info")
public class User implements IUser, Serializable {

    @Column(name = "user_id", columnDefinition = "varchar(64) NOT NULL COMMENT '会员id'")
    @Id
    private String id;
    
    @Column(name = "biz_id", columnDefinition = "int(11) NOT NULL DEFAULT 1000 COMMENT ' 业务ID,用于系统显示和推荐'")
    private Integer bizId;

    @Column(name = "user_name", columnDefinition = "varchar(64) DEFAULT NULL COMMENT '会员名称'")
    private String userName;

    @Column(name = "nick_name", columnDefinition = "varchar(64) DEFAULT NULL COMMENT '会员昵称'")
    private String nickName;

    @Column(name = "real_name", columnDefinition = "varchar(64) DEFAULT NULL COMMENT '真实姓名'")
    private String realName;

    @Column(name = "sex", columnDefinition = "tinyint(4) DEFAULT NULL COMMENT '0：保密；1.男，2女'")
    private Integer sex = 0;

    @Column(name = "email", columnDefinition = "varchar(128) DEFAULT NULL COMMENT '邮箱'")
    private String email;

    @Column(name = "mobile_phone", columnDefinition = "varchar(20) DEFAULT NULL COMMENT '手机号码'")
    private String mobilePhone;

    @Column(name = "wechat_name", columnDefinition = "varchar(30) DEFAULT NULL COMMENT '微信账号名'")
    private String wechatName;

    @Column(name = "referrer_id", columnDefinition = "varchar(64) DEFAULT NULL COMMENT '最近一级推荐者id'")
    private String referrerId;

    @Column(name = "presenter_list", columnDefinition = "varchar(512) DEFAULT NULL COMMENT '邀请链接'")
    private String presenterList;

    @Column(name = "level", columnDefinition = " int(11) DEFAULT NULL COMMENT '会员级别'")
    private Integer level = 0;

    @Column(name = "referre_url", columnDefinition = " varchar(2000) DEFAULT NULL COMMENT '推荐关系链 /xx1/xx2/……/按推荐的层级排序，最右边是最近的一级'")
    private String referreUrl;

    @Column(name = "status", columnDefinition = " tinyint(4) DEFAULT NULL COMMENT '删除标记0：可用；1、已删除；2、禁用'")
    private Integer status;

    @Column(name = "check_status", columnDefinition = " tinyint(4) DEFAULT -1 COMMENT '审核标记 -1：待提交认证交 0：待审核；1、通过；2、不通过'")
    private Integer checkStatus = 0;

    @Column(name = "check_reason", columnDefinition = " varchar(512) DEFAULT NULL COMMENT '审核理由（不通过）'")
    private String checkReason;

    @Column(name = "create_time", columnDefinition = " timestamp NULL DEFAULT NULL COMMENT '创建时间'")
    private Date createTime;

    @Column(name = "last_modified", columnDefinition = " timestamp NULL DEFAULT NULL COMMENT '活跃时间'")
    private Date lastModified;

    @Column(name = "password", columnDefinition = " varchar(64) NULL DEFAULT NULL COMMENT '密码'")
    private String password;

    @Column(name = "head_image", columnDefinition = " varchar(128) NULL DEFAULT NULL COMMENT '头像'")
    private String headImage;

    @Column(name = "card_id", columnDefinition = " varchar(128) NULL DEFAULT NULL COMMENT '身份证号码'")
    private String cardId;

    @Column(name = "card_image1", columnDefinition = " varchar(128) NULL DEFAULT NULL COMMENT '身份证照片1'")
    private String cardImage1;

    @Column(name = "card_image2", columnDefinition = " varchar(128) NULL DEFAULT NULL COMMENT '身份证照片2'")
    private String cardImage2;

    @Column(name = "card_image3", columnDefinition = " varchar(128) NULL DEFAULT NULL COMMENT '手持身份证照片1'")
    private String cardImage3;

    @Column(name = "type", columnDefinition = " tinyint(4) DEFAULT 0 COMMENT ' 1、超级管理员（所有权限）；2、一般内部用户 ；  0: 外部注册用户 ; 3 外部关联用户(微信等)'")
    private Integer type;

    @Column(name = "summary", columnDefinition = " varchar(1024) NULL DEFAULT NULL COMMENT '简介'")
    private String summary;

    @Column(name = "city", columnDefinition = " varchar(64) NULL DEFAULT NULL COMMENT '所在城市'")
    private String city;

    @Column(name = "addr", columnDefinition = " varchar(1024) NULL DEFAULT NULL COMMENT '地址'")
    private String addr;
    
    @Column(name = "deal_password", columnDefinition = " varchar(64) NULL DEFAULT NULL COMMENT '交易密码'")
    private String dealPassword;
    
    @Column(name = "bank_code", columnDefinition = " varchar(64) NULL DEFAULT NULL COMMENT '银行编号'")
    private String bankCode;
    
    @Column(name = "bank_name", columnDefinition = " varchar(64) NULL DEFAULT NULL COMMENT '银行名称'")
    private String bankName;
    
    @Column(name = "bank_no", columnDefinition = " varchar(64) NULL DEFAULT NULL COMMENT '银行卡号'")
    private String bankNo;
    
    @Column(name = "zfb_no", columnDefinition = " varchar(64) NULL DEFAULT NULL COMMENT '支付宝账号'")
    private String zfbNo;
    
    @Column(name = "wx_no", columnDefinition = " varchar(64) NULL DEFAULT NULL COMMENT '微信账号'")
    private String wxNo;
    
    @Column(name = "btc_addr", columnDefinition = " varchar(128) NULL DEFAULT NULL COMMENT 'BTC地址'")
    private String btcAddr;
    
    @Column(name = "eth_addr", columnDefinition = " varchar(128) NULL DEFAULT NULL COMMENT 'ETH地址'")
    private String ethAddr;

    @Transient
    private String checkStatusName = null;
    @Transient
    private String smsCode;
    @Transient
    private String validateCode;    

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getUserName() {
        return this.userName;
    }

    @Override
    public List<String> getRole() {
        return new ArrayList<String>();
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
    
    public Integer getBizId() {
        return bizId;
    }

    public void setBizId(Integer bizId) {
        this.bizId = bizId;
    }

    @Override
    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    @Override
    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobilePhone() {
        return mobilePhone;
    }

    public void setMobilePhone(String mobilePhone) {
        this.mobilePhone = mobilePhone;
    }

    public String getWechatName() {
        return wechatName;
    }

    public void setWechatName(String wechatName) {
        this.wechatName = wechatName;
    }

    public String getReferrerId() {
        return referrerId;
    }

    public void setReferrerId(String referrerId) {
        this.referrerId = referrerId;
    }

    public String getPresenterList() {
        return presenterList;
    }

    public void setPresenterList(String presenterList) {
        this.presenterList = presenterList;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public String getReferreUrl() {
        return referreUrl;
    }

    public void setReferreUrl(String referreUrl) {
        this.referreUrl = referreUrl;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastModified() {
        return lastModified;
    }

    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getHeadImage() {
        return headImage;
    }

    public void setHeadImage(String headImage) {
        this.headImage = headImage;
    }

    public Integer getCheckStatus() {
        return checkStatus;
    }

    public void setCheckStatus(Integer checkStatus) {
        this.checkStatus = checkStatus;
    }

    public String getCheckReason() {
        return checkReason;
    }

    public void setCheckReason(String checkReason) {
        this.checkReason = checkReason;
    }

    @Override
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }

    public String getCardImage1() {
        return cardImage1;
    }

    public void setCardImage1(String cardImage1) {
        this.cardImage1 = cardImage1;
    }

    public String getCardImage2() {
        return cardImage2;
    }

    public void setCardImage2(String cardImage2) {
        this.cardImage2 = cardImage2;
    }

    public String getCardImage3() {
        return cardImage3;
    }

    public void setCardImage3(String cardImage3) {
        this.cardImage3 = cardImage3;
    }

    @Transient
    private String sdate;

    public String getSdate() {
        if (null != this.createTime) {
            sdate = TimeUtils.parseNLPattern(this.createTime);
        }
        return sdate;
    }

    public void setSdate(String sdate) {
        this.sdate = sdate;
    }

    public String getCheckStatusName() {
        if (this.checkStatus == null)
            this.checkStatusName = "";
        else if (this.checkStatus.intValue() == UserCheckStatusEnum.NORMAL.getValue())
            this.checkStatusName = UserCheckStatusEnum.NORMAL.getText();
        else if (this.checkStatus.intValue() == UserCheckStatusEnum.UN_AREAA.getValue())
            this.checkStatusName = UserCheckStatusEnum.UN_AREAA.getText();
        else if (this.checkStatus.intValue() == UserCheckStatusEnum.UN_CHECK.getValue())
            this.checkStatusName = UserCheckStatusEnum.UN_CHECK.getText();
        else if (this.checkStatus.intValue() == UserCheckStatusEnum.UN_SUBMIT.getValue())
            this.checkStatusName = UserCheckStatusEnum.UN_SUBMIT.getText();
        else
            this.checkStatusName = "未知状态";
        return this.checkStatusName;
    }

    public void setCheckStatusName(String checkStatusName) {
        this.checkStatusName = checkStatusName;
    }

    public String getSmsCode() {
        return smsCode;
    }

    public void setSmsCode(String smsCode) {
        this.smsCode = smsCode;
    }
    
    public String getDealPassword() {
        return dealPassword;
    }

    public void setDealPassword(String dealPassword) {
        this.dealPassword = dealPassword;
    }

    public String getValidateCode() {
        return validateCode;
    }

    public void setValidateCode(String validateCode) {
        this.validateCode = validateCode;
    }

    public String getBankCode() {
        return bankCode;
    }

    public void setBankCode(String bankCode) {
        this.bankCode = bankCode;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getBankNo() {
        return bankNo;
    }

    public void setBankNo(String bankNo) {
        this.bankNo = bankNo;
    }

    public String getZfbNo() {
        return zfbNo;
    }

    public void setZfbNo(String zfbNo) {
        this.zfbNo = zfbNo;
    }

    public String getWxNo() {
        return wxNo;
    }

    public void setWxNo(String wxNo) {
        this.wxNo = wxNo;
    }
    
}
